from IPython.display import Image
from PIL import Image as PILImage
import io


def save_graph(graph, save_path, xray=True):
    img = Image(graph.get_graph(xray=xray).draw_mermaid_png())
    pil_img = PILImage.open(io.BytesIO(img.data))
    pil_img.save(save_path)
